/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.lvsrobot.vehicletcp;

import com.google.inject.assistedinject.Assisted;
import org.opentcs.components.kernel.services.TCSObjectService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.awt.*;
import java.beans.PropertyChangeEvent;
import javax.inject.Inject;
import javax.swing.*;
import javax.swing.border.*;

import static java.util.Objects.requireNonNull;

/**
 *
 * @author cisco
 */
@Deprecated
public class TCPCommunicationAdapterPanel extends
        org.opentcs.drivers.vehicle.VehicleCommAdapterPanel {

    private final TCPCommAdapter commAdapter;
    private final TCSObjectService objectService;
    private final TCPProcessModel vehicleModel;
    /**
     * This class's Logger.
     */
    private static final Logger LOG = LoggerFactory.getLogger(TCPCommunicationAdapterPanel.class);


    /**
     * Creates new LoopbackCommunicationAdapterPanel.
     *
     * @param adapter The loopback communication adapter.
     */
    @Inject
    TCPCommunicationAdapterPanel(TCSObjectService objectService,
                                      @Assisted TCPCommAdapter adapter) {
        this.objectService = requireNonNull(objectService, "objectService");
        this.commAdapter = requireNonNull(adapter, "adapter");
        this.vehicleModel = adapter.getProcessModel();

        initComponents();
        LOG.info("Swing Panel");
//        maxFwdVeloTxt.setText(String.valueOf(vehicleModel.getMaxFwdVelocity()));
//        maxRevVeloTxt.setText(String.valueOf(vehicleModel.getMaxRevVelocity()));
//        opTimeTxt.setText(String.valueOf(vehicleModel.getOperatingTime()));
//        maxAccelTxt.setText(String.valueOf(vehicleModel.getMaxAcceleration()));
//        maxDecelTxt.setText(String.valueOf(vehicleModel.getMaxDecceleration()));
//        updateCommAdapterEnabled(vehicleModel.isCommAdapterEnabled());
    }

    /**
     * Returns the title for this comm adapter panel.
     * The default implementation returns the accessible name from the panel's accessible context.
     *
     * @return The title for this comm adapter panel.
     */
    public String getTitle() {
        return "hello ";
    }

    @Override
    public void propertyChange(PropertyChangeEvent evt) {

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - 蒋滨鸿
    private void initComponents() {
        panel1 = new JPanel();
        panel2 = new JPanel();
        panel4 = new JPanel();
        checkBox1 = new JCheckBox();
        panel5 = new JPanel();
        label4 = new JLabel();
        textField4 = new JTextField();
        label5 = new JLabel();
        textField5 = new JTextField();
        label6 = new JLabel();
        textField6 = new JTextField();
        panel3 = new JPanel();
        panel6 = new JPanel();
        scrollPane1 = new JScrollPane();
        list1 = new JList();

        //======== this ========
        setBorder(new javax.swing.border.CompoundBorder(new javax.swing.border.TitledBorder(new javax.swing
        .border.EmptyBorder(0,0,0,0), "JFor\u006dDesi\u0067ner \u0045valu\u0061tion",javax.swing.border.TitledBorder
        .CENTER,javax.swing.border.TitledBorder.BOTTOM,new java.awt.Font("Dia\u006cog",java.
        awt.Font.BOLD,12),java.awt.Color.red), getBorder()))
        ; addPropertyChangeListener(new java.beans.PropertyChangeListener(){@Override public void propertyChange(java.beans.PropertyChangeEvent e
        ){if("bord\u0065r".equals(e.getPropertyName()))throw new RuntimeException();}})
        ;
        setLayout(new BorderLayout());

        //======== panel1 ========
        {
            panel1.setLayout(new BorderLayout());

            //======== panel2 ========
            {
                panel2.setLayout(new BorderLayout());

                //======== panel4 ========
                {
                    panel4.setBorder(new TitledBorder("enable"));
                    panel4.setLayout(new FlowLayout());

                    //---- checkBox1 ----
                    checkBox1.setText("text");
                    panel4.add(checkBox1);
                }
                panel2.add(panel4, BorderLayout.NORTH);

                //======== panel5 ========
                {
                    panel5.setLayout(new GridBagLayout());
                    ((GridBagLayout)panel5.getLayout()).columnWidths = new int[] {62, 226, 0};
                    ((GridBagLayout)panel5.getLayout()).rowHeights = new int[] {0, 0, 0, 0};
                    ((GridBagLayout)panel5.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0E-4};
                    ((GridBagLayout)panel5.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 1.0E-4};

                    //---- label4 ----
                    label4.setText("text");
                    panel5.add(label4, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                        new Insets(0, 0, 5, 5), 0, 0));
                    panel5.add(textField4, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                        new Insets(0, 0, 5, 0), 0, 0));

                    //---- label5 ----
                    label5.setText("text");
                    panel5.add(label5, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                        new Insets(0, 0, 5, 5), 0, 0));
                    panel5.add(textField5, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                        new Insets(0, 0, 5, 0), 0, 0));

                    //---- label6 ----
                    label6.setText("text");
                    panel5.add(label6, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                        new Insets(0, 0, 0, 5), 0, 0));
                    panel5.add(textField6, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                        new Insets(0, 0, 0, 0), 0, 0));
                }
                panel2.add(panel5, BorderLayout.CENTER);
            }
            panel1.add(panel2, BorderLayout.LINE_START);

            //======== panel3 ========
            {
                panel3.setLayout(new BorderLayout());

                //======== panel6 ========
                {
                    panel6.setLayout(new GridBagLayout());
                    ((GridBagLayout)panel6.getLayout()).columnWidths = new int[] {0, 0, 0};
                    ((GridBagLayout)panel6.getLayout()).rowHeights = new int[] {0, 0, 0, 0};
                    ((GridBagLayout)panel6.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0E-4};
                    ((GridBagLayout)panel6.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 1.0E-4};

                    //======== scrollPane1 ========
                    {
                        scrollPane1.setViewportView(list1);
                    }
                    panel6.add(scrollPane1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                        new Insets(0, 0, 5, 5), 0, 0));
                }
                panel3.add(panel6, BorderLayout.CENTER);
            }
            panel1.add(panel3, BorderLayout.CENTER);
        }
        add(panel1, BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // Generated using JFormDesigner Evaluation license - 蒋滨鸿
    private JPanel panel1;
    private JPanel panel2;
    private JPanel panel4;
    private JCheckBox checkBox1;
    private JPanel panel5;
    private JLabel label4;
    private JTextField textField4;
    private JLabel label5;
    private JTextField textField5;
    private JLabel label6;
    private JTextField textField6;
    private JPanel panel3;
    private JPanel panel6;
    private JScrollPane scrollPane1;
    private JList list1;
    // End of variables declaration//GEN-END:variables
}
